package com.ghck.server.dao;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.ghck.server.dao.provider.TestCategoryDictProvider;
import com.ghck.server.model.TestCategoryDict;
import com.ghck.server.model.query.TestCategoryDictQuery;
import com.ghck.server.model.response.TestCategoryDictRes;
/**
 * 健康自测类型-支持管理平台配置  <br>
 * dict_test_category <br>
 * v1.0 2016-05-01
 */
 public interface TestCategoryDictMapper {
 	
 	/**
 	*根据id删除 健康自测类型-支持管理平台配置
 	*/
 	@Delete("delete from dict_test_category where id=#{id}")
 	public Integer deleteById(Integer id);
 	
 	/**
 	* 批量新增 健康自测类型-支持管理平台配置
 	*/
 	@InsertProvider(method="batchInsert",type=TestCategoryDictProvider.class)
	@Options(useGeneratedKeys=true,keyColumn="id",keyProperty="list[0].id")
 	public Integer batchInsert(List<? extends TestCategoryDict> testCategoryDicts);
 	
 	/**
 	* 新增 健康自测类型-支持管理平台配置
 	*/
 	@InsertProvider(method="insert",type=TestCategoryDictProvider.class)
	@Options(useGeneratedKeys=true)
 	public Integer insert(TestCategoryDict domain);
 
 	
 	/**
 	*更新 健康自测类型-支持管理平台配置
 	*/
 	@UpdateProvider(method="update",type=TestCategoryDictProvider.class)
 	public Integer update(TestCategoryDict domain);
 	
 	/**
 	*根据ID查询 健康自测类型-支持管理平台配置
 	*/
	@Select("select * from dict_test_category where id=#{id}")
	public TestCategoryDictRes findById(Integer id);
	
	/**
 	*通过query 查询 健康自测类型-支持管理平台配置
 	*/
 	@SelectProvider(method="findByQuery",type=TestCategoryDictProvider.class)
 	public List<TestCategoryDict> findByQuery(TestCategoryDictQuery query);
 	
 	/**
 	*通过query count总条数
 	*/
 	@SelectProvider(method="countByQuery",type=TestCategoryDictProvider.class)
 	public Integer countByQuery(TestCategoryDictQuery query);
 	
 	/**
 	* 通过ids查询
 	*/
 	@SelectProvider(method="findByIds",type=TestCategoryDictProvider.class)
 	public List<TestCategoryDict> findByIds(List<Integer> ids);
 	
 	 /**
 	*根据name查询 健康自测类型-支持管理平台配置
 	*/
	@Select("select * from dict_test_category where name=#{name} limit 1")
	public TestCategoryDict findByName(String name);
	
	/**
 	*获取所有字典 健康自测类型-支持管理平台配置
 	*/
	@Select("select * from dict_test_category where in_used = 1")
	public List<TestCategoryDictRes> findAll();
	
	/**
	 * 按照 seq 倒叙排序
	 * @param parentId
	 * @param start
	 * @param limit
	 * @return
	 */
	@SelectProvider(method="findByParentId",type=TestCategoryDictProvider.class)
	public List<TestCategoryDict> findByParentId(@Param("parentId") Integer parentId,@Param("start") Integer start,@Param("limit") Integer limit);
	
	@Select("select * from dict_test_category where id=#{id}")
	public TestCategoryDictRes findResById(Integer id);
	
}	